<template>
	<view style="min-height: 100vh;background-color: #F5F7FA;">
		<hx-navbar ref="hxnb" :config="config" />
		<view :class="'ckp ' + (show ? 'showon':'showdown')" style="background-image: url('/static/ckp.png');"
			ref="ckp" />
		<view :class="'context ' + (show ? 'showon':'showdown')" style="background-image: url('/static/hcp.png');"
			ref="context">
			<div class="line-a">
				<div class="box1">{{train.start_station.value}}</div>
				<div class="box2">
					<div class="top">{{train.train_num.value}}</div>
					<!-- <div><image class="bot" src="/static/jt.png"></image></div> -->
					<div class="bot" style="background-image: url('/static/jt.png');"></div>
				</div>
				<div class="box3">{{train.terminal_station.value}}</div>
			</div>
			<div class="line-b">
				<div class="box4">{{train.d_date.value}}</div>
				<div class="box5">{{train.seat_num.value}}</div>
			</div>
			<div class="line-c">
				<div class="box6">{{train.name.value}}</div>
				<div class="box7">{{train.train_class.value}}</div>
			</div>
			<div class="line-d">
				<div class="box8">
					<div class="first">票号:</div>
					<div class="last">{{train.ticket_num.value}}</div>
				</div>
				<div class="box9">
					<div class="first">票价:</div>
					<div class="last">{{train.fare.value}}</div>
				</div>
			</div>
		</view>
		<view class="sub-area">
			<view class="form">
				<uni-list>
					<uni-list-item title="进项税额" rightText="￥1.2" style="height: 64px;"></uni-list-item>
					<uni-list-item title="查看票据" showArrow style="height: 63.5px;"></uni-list-item>
					<uni-list-item title="转交给其他同事" showArrow style="height: 63.5px;"></uni-list-item>
				</uni-list>
			</view>
		</view>
		<view class="button-bottom-bar">
			<custom-double-button :save="save" :edit="edit"></custom-double-button>
		</view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				config: {
					title: '火车票',
					color: '#FFFFFF',
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [1, ['#0052D9', '#0060FF']],
					// 滑动屏幕后切换颜色，注意颜色为数组时长度必须一样，还有使用滑动切换必须监听 onPageScroll 事件
					slideBackgroundColor: [0.2, ['#0052D9', '#0060FF']],
					// 状态栏 ，数组则为滑动变色
					statusBarBackground: ['', '#ffffff'],
					backgroundImg: ['/static/bj.png', '/static/bj.png', 1, 0],
					backgroundImgHeight: 138,
					backgroundColorLinearDeg: '229deg'
				},
				show: true,
				train: {
					start_station: {
						description: '',
						value: '长春西'
					},
					train_num: {
						description: '',
						value: 'G952'
					},
					terminal_station: {
						description: '',
						value: '北京西'
					},
					d_date: {
						description: '',
						value: '2019-10-02 13:10'
					},
					seat_num: {
						description: '',
						value: '13车厢03D号'
					},
					name: {
						description: '',
						value: '徐家斌'
					},
					train_class: {
						description: '',
						value: '二等座'
					},
					ticket_num: {
						description: '',
						value: 'E042391'
					},
					fare: {
						description: '',
						value: '￥611.00'
					},
				}
			}
		},
		onPageScroll(e) {
			// 重点，用到滑动切换必须加上
			this.$refs.hxnb.pageScroll(e);
			if (e.scrollTop > uni.getSystemInfoSync().statusBarHeight + 44) {
				this.show = false;
			} else {
				this.show = true;
			}
		},
		methods: {
			edit() {
				uni.navigateTo({
					url: '/pages/train/edit/edit'
				})
			},
			save() {
				uni.navigateTo({
					url: '/pages/index/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.ckp {
		width: 100%;
		height: 16px;
		background: #BFD7FF;
		box-shadow: 0 0 8px 0 rgba(13, 49, 116, 0.10);
		border-radius: 4px;
		background-size: 100% 100%;
		/* 背景图片被拉伸,覆盖整个元素 */
		margin-bottom: -8px;
		position: relative;
	}

	.showon {
		z-index: 100;
	}

	.showdown {
		z-index: 0;
	}

	.context {
		width: auto;
		/* 原来是100%1111 */
		height: 240px;
		/* background: #F2F9FE; */
		background-size: 100% 100%;
		/* 背景图片被拉伸,覆盖整个元素 */
		box-shadow: 0 0 8px 0 rgba(13, 49, 116, 0.10);
		margin-left: 12px;
		margin-right: 12px;
		border-bottom-left-radius: 8px;
		border-bottom-right-radius: 8px;
		position: relative;
	}

	.context .line-a {
		height: 60px;
		display: flex;
		flex-direction: row;
	}

	.context .line-a .box1 {
		width: 78px;
		flex: 1;
		height: 26px;
		font-family: serif;
		font-weight: 500;
		font-size: 26px;
		color: #122453;
		letter-spacing: 0;
		line-height: 26px;
		float: left;
		margin-top: 32px;
		margin-left: 24px;
	}

	.context .line-a .box2 {
		width: 108px;
		flex: 1;
		height: 24px;
		float: left;
		margin-left: 20px;
		/* 后修改  可能是宽度变为100%*/
		margin-top: 33px;
		margin-right: 19px;
	}

	.context .line-a .box2 .top {
		width: 39px;
		height: 16px;
		font-family: HarmonyOS_Sans;
		font-weight: Sans;
		font-size: 16px;
		color: rgba(18, 36, 83, 0.50);
		letter-spacing: 0;
		text-align: center;
		line-height: 16px;
		font-family: HarmonyOS_Sans;
		font-weight: Sans;
		font-size: 16px;
		color: rgba(18, 36, 83, 0.50);
		margin-left: 34.5px;
	}

	.context .line-a .box2 .bot {
		width: 103.98px;
		height: 4.31px;
		background-size: cover;
		margin-top: 2px;
	}

	.context .line-a .box3 {
		width: 78px;
		flex: 1;
		height: 26px;
		font-family: serif;
		font-weight: 500;
		font-size: 26px;
		color: #122453;
		letter-spacing: 0;
		text-align: right;
		line-height: 26px;
		float: right;
		margin-top: 32px;
		margin-right: 24px;
	}

	.context .line-b .box4 {
		width: 139px;
		height: 16px;
		font-family: HarmonyOS_Sans;
		font-weight: Sans;
		font-size: 16px;
		color: rgba(18, 36, 83, 0.50);
		letter-spacing: 0;
		line-height: 16px;
		float: left;
		margin-top: 32px;
		margin-left: 24px;
	}

	.context .line-b .box5 {

		height: 16px;
		color: rgba(18, 36, 83, 0.5);
		font-size: 16px;
		font-face: HarmonyOS;
		font-weight: Sans;
		line-height: 16px;
		letter-spacing: 0;
		paragraph-spacing: 0;
		text-align: center;
		float: right;
		margin-top: 32px;
		margin-right: 24px;
	}

	.context .line-c .box6 {
		width: 48px;

		height: 16px;
		font-family: PingFangSC-Regular;
		font-weight: 400;
		font-size: 16px;
		color: #122453;
		letter-spacing: 0;
		text-align: right;
		line-height: 16px;

		float: left;
		margin-top: 24px;
		margin-left: 24px;
		margin-right: 207px;
	}

	.context .line-c .box7 {
		width: 48px;
		height: 16px;
		font-family: PingFangSC-Regular;
		font-weight: 400;
		font-size: 16px;
		color: #122453;
		letter-spacing: 0;
		text-align: right;
		line-height: 16px;

		float: right;
		margin-top: 24px;
		margin-right: 24px;

	}

	.context .line-d {}

	.context .line-d .box8 {
		float: left;
		margin: 53px 83px 25px 24px;
	}

	.context .line-d .box8 .first {
		width: 48px;
		height: 16px;
		font-family: PingFangSC-Regular;
		font-weight: 400;
		font-size: 16px;
		color: rgba(18, 36, 83, 0.50);
		letter-spacing: 0;
		line-height: 16px;
		float: left;
	}

	.context .line-d .box8 .last {
		width: 65px;
		height: 16px;
		font-family: HarmonyOS_Sans;
		font-weight: Sans;
		font-size: 16px;
		color: #122453;
		letter-spacing: 0;
		line-height: 16px;
		float: right;
	}

	.context .line-d .box9 {
		float: right;
		margin: 53px 24px 25px 0px;
	}

	.context .line-d .box9 .first {
		width: 48px;
		height: 16px;
		font-family: PingFangSC-Regular;
		font-weight: 400;
		font-size: 16px;
		color: rgba(18, 36, 83, 0.50);
		letter-spacing: 0;
		line-height: 16px;

		float: left;
		/* margin-top: 53px; */
		/* padding-left: 0px; */
	}

	.context .line-d .box9 .last {
		width: 59px;
		height: 16px;
		font-family: HarmonyOS_Sans;
		font-weight: Sans;
		font-size: 16px;
		color: #122453;
		letter-spacing: 0;
		line-height: 16px;

		float: right;
		/* margin-top: 53px;
		margin-right: 24px; */
	}

	.sub-area {
		padding-bottom: 60px;

		.form {
			width: auto;
			height: 192px;
			background: #FFFFFF;
			box-shadow: 0 0 8px 0 rgba(13, 49, 116, 0.10);
			/* 正常定位距离 */
			margin-top: 18px;
			margin-left: 12px;
			margin-right: 12px;
			border-radius: 8px;
		}
	}


	.button-bottom-bar {
		position: fixed;
		bottom: 16px;
		width: 100%;
	}
</style>
